var LifeCrycle = require('./life-cycle');
var elementOwnAttached = require('./element-own-attached');
var compileComponent = require('./compile-component');
function Component(options) {
    if (typeof console === 'object' && console.warn) {
        for (var key in Component.prototype) {
            if (this[key] !== Component.prototype[key]) {
                console.warn('[ZOOLON WARNING]\`' + key + '\`')
            }
        }
    }
    options = options || {};
    this.lifeCycle = LifeCrycle.start;
    this.children = [];
    this._elFns = [];
    this.listeners = {};
    this.slotChildren = [];
    var clazz = this.constructor;
    this.filters = this.filters || clazz.filters || {};
    this.computed = this.computed || clazz.computed || {};
    this.messages = this.messages || clazz.messages || {};
    if (options.transition) {
        this.transition = options.transition;
    }

    this.subTag = options.subTag;
    compileComponent(clazz);
    this.subTag = options.subTag;

}
Component.prototype._callHook =
    Component.prototype._toPhase = function (name) {
        if (!this.lifeCrycle[name]) {
            this.lifeCrycle = LifeCrycle[name] || this.lifeCrycle;
            if (typeof this[name] == 'function') {
                this[name]();
            }
            this['_after' + name] = 1;
            // #[begin] devtool //不留

            // #[end]
        }
    }
Component.prototype.attach = elementOwnAttach;
exports = module.exports = Component;